const {
    LinValidator,
    Rule
} = require('../../core/lin-validator-v2')

const {
    optionsIdValidator,
    PaginateValidator
} = require('./common')

class addGoodsValidator extends optionsIdValidator { //新增
    constructor() {
        super()
        this.goodsIds = [
            new Rule('isOptional'),
            new Rule('isLength', '不符合规范', {
                min: 1,
                max: 32
            }),
        ]
    }
}
class uidClass extends optionsIdValidator { //继承id基类

}
class listValidator extends PaginateValidator { //列表

}

class commitBuyOrderValidator extends LinValidator { //提交订单
    constructor() {
        super()
    }
    validateAuths(data) {
        const list = data.body.list;
        if (!Array.isArray(list)) {
            return [false, 'list必须为非空数组'];
        }
        if (list.length < 1) {
            return [false, 'list必须为非空数组'];
        }
        return true;
    }
}

module.exports = {
    addGoodsValidator,
    listValidator,
    commitBuyOrderValidator
}